package com.aiyan.edu.nacos.provider.example;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zqzhou
 * @create: 2019/12/11 14:28
 **/
@SpringBootApplication
@EnableDiscoveryClient
public class NacosProviderApplication {

    public static void main(String[] args) {
        SpringApplication.run(NacosProviderApplication.class, args);
    }

    @RestController
    @Slf4j
    static class TestController {

        @Value("${server.port}")
        Integer serverPort;

        @GetMapping("/provider/hello/{id}")
        public String hello(@PathVariable("id") String id) {
            return serverPort + " hello , " + id;
        }
    }
}
